package com.leyou.item.client;

import com.leyou.common.dto.PageDTO;
import com.leyou.item.dto.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("item-service")
public interface ItemClients {


    //分页查询
    @GetMapping("/goods/spu/page")
    PageDTO<SpuDTO> pageQuery(
            @RequestParam(value = "rows",defaultValue = "5")Integer rows,
            @RequestParam(value = "page",defaultValue = "1")Integer page,
            @RequestParam(value = "categoryId",required = false)Long categoryId,
            @RequestParam(value = "brandId",required = false)Long brandId,
            @RequestParam(value = "id",required = false)Long id,
            @RequestParam(value = "saleable",required = false)Boolean saleable);

    //根据spuID查询sku的集合
    @GetMapping("/goods/sku/of/spu")
    List<SkuDTO> listSkuBySpu(@RequestParam("id")Long id);

  //根据商品id查询规格参数
    @GetMapping("/goods/spec/value")
   List<SpecParamDTO> querySpecParamBySpu(
            @RequestParam("id")Long id,
            @RequestParam(value = "searching",required = false)Boolean searching);

    //根据品牌id查询对应的集合
    @GetMapping("/brand/list")
    List<BrandDTO> querybrandlist(@RequestParam("ids") List<Long> ids);


    //根据id查询商品分类的集合
    @GetMapping("/category/list")
    List<CategoryDTO> queryCategoryByIds(
            @RequestParam("ids") List<Long> ids);

    //根据spuid查询的基本信息
    @GetMapping("/goods/spu/{id}")
    SpuDTO querySpuById(@PathVariable("id")Long id);

    //根据spuid查询detail
    @GetMapping("/goods/spu/detail")
   SpuDetailDTO queryDetailById(@RequestParam("id")Long spuId);



    //根据brandid查询brand
    @GetMapping("/brand/{id}")
   BrandDTO queryBrandById(@PathVariable("id")Long id);

    //根据categoryid查询规格组及组内参数
    @GetMapping("/spec/list/of/category")
    List<SpecGroupDTO> querySpecList(
            @RequestParam("id") Long cid);

}

